Repository navigation
feat(db): verify database schema matches code on startup (#352) - #537
Merged
Miracle656 merged 1 commit intoOct 22, 2026
Conversation
Miracle656
added a commit
that referenced
this pull request
Oct 22, 2026
tsc --noEmit clean vitest 100 files, 1146 passing (up from 99 / 1140) #557 operations runbook #537 verify the database schema matches the code on start-up #536 send a graceful close frame to WebSocket clients on shutdown The dropped-tests guard flagged one case, and it was the good kind: - src/__tests__/fanout.test.ts :: destroy cleans up all state renamed to "destroy cleans up all state idempotently" and joined by two new shutdown cases. Strengthened, not lost. That is the second time today the guard surfaced a rename rather than a deletion, which is the point of it -- the decision gets made either way. A note on #537, because start-up checks have a history here. It verifies the schema matches the code; it does not refuse to boot over a partial dependency. That distinction matters: a startup validator merged into wraith two days ago made a missing per-network RPC URL fatal and crash-looped the service for forty minutes. A schema mismatch genuinely does make the whole process useless, so this one is on the right side of the line. Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #352
Summary of Changes
assertSchemaValid()insrc/db/schemaVerify.tschecking for existence of all required tables and columns against PostgreSQLinformation_schemaon boot.DatabaseSchemaMismatchErrorexplicitly naming any missing tables or columns before request handling begins.src/index.tsimmediately afterpgPool.connect().prisma db pushinstead of migrations, outlining the architectural trade-offs and future transition path toprisma migrateindocs/database-schema.md.src/__tests__/schemaVerification.test.ts.